<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2020/7/27
  Time: 18:23
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="css/bootstrap.min.css">
    <title>学员管理系统</title>
</head>
<style>
    td, th {
        text-align: center;
    }

    #footer {
        position: absolute;
        bottom: 0;
        width: 100%;
        text-align: center;
    }
</style>
<body style="padding: 50px;">
<div>
    <button class="btn btn-primary" onclick="addItem()">新增</button>
    <button class="btn btn-primary" id="select">查询</button>
    <button class="btn btn-primary" onclick="updateItem()">编辑</button>
    <button class="btn btn-primary" onclick="deleteItem()">删除</button>
    <input type="text" placeholder="按用户名查询" id="findName">
</div>
</body>
<script src="js/jquery.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<script>

    function addItem() {
        window.location.href = "add.jsp";
    }


    function updateItem() {
        var username = $("#findName").val();
        $.post("find", {'username': username},
            function (dat) {


            }, "json");
        window.location.href = "add.jsp";
    }

    function deleteItem() {
        var username = $("#findName").val();
        $.post(
            "delete",
            {'username': username},
            function (dat) {
                console.log("hhhh")
            }, "json");
    }


    //查询
    $("#select").click(function () {
        //获取输入框输入的值
        var username = $("#findName").val();
        $.post("find", {'username': username},
            function (dat) {
            }, "json");
    })


</script>

</html>
